package com.church.daoimpl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.church.dao.CatechumenateDao;
import com.church.db.Catechumenate;

public class CatechumenateDaoImpl extends HibernateDaoSupport implements
		CatechumenateDao {

	public Catechumenate getCatechumenateById(int id) {
		List<Catechumenate> list = this.getHibernateTemplate().find(
				"from Catechumenate where id=" + id);
		if (list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

	public String add(Catechumenate catechumenate) {
		this.getHibernateTemplate().save(catechumenate);
		return "success";
	}

	public String update(Catechumenate catechumenate) {
		this.getHibernateTemplate().update(catechumenate);
		return "success";
	}

	public List<Catechumenate> getList() {
		return this.getHibernateTemplate().find("from Catechumenate where state!='3'");
	}

}
